<?php

namespace App\Http\Controllers\App;

use App\Http\Resources\App\CourseDetailResource;
use App\Models\Course;
use App\Models\Skill;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

class SkillCourseController extends Controller
{
    public function next(Skill $skill, Course $course)
    {
        $skillCourse = $skill->courses()->findOrFail($course->id);
        $next_ids = $skillCourse->pivot->next_course_id;
        return CourseDetailResource::collection($course->find($next_ids));
    }
}
